home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / ch.vim < prev    next >
Encoding:
Text File  |  2001-05-11  |  7.5 KB  |  192 lines

  1. " Vim syntax file
  2. " Language:    CHILL
  3. " Maintainer:    YoungSang Yoon <image@lgic.co.kr>
  4. " Last change:    2001 May 10
  5. "
  6.  
  7. " first created by image@lgic.co.kr & modified by paris@lgic.co.kr
  8.  
  9. " CHILL (CCITT High Level Programming Language) is used for
  10. " developing software of ATM switch at LGIC (LG Information
  11. " & Communications LTd.)
  12.  
  13.  
  14. " For version 5.x: Clear all syntax items
  15. " For version 6.x: Quit when a syntax file was already loaded
  16. if version < 600
  17.   syntax clear
  18. elseif exists("b:current_syntax")
  19.   finish
  20. endif
  21.  
  22. " A bunch of useful CHILL keywords
  23. syn keyword    chStatement    goto GOTO return RETURN returns RETURNS
  24. syn keyword    chLabel        CASE case ESAC esac
  25. syn keyword    chConditional    if IF else ELSE elsif ELSIF switch SWITCH THEN then FI fi
  26. syn keyword    chLogical    NOT not
  27. syn keyword    chRepeat    while WHILE for FOR do DO od OD TO to
  28. syn keyword    chProcess    START start STACKSIZE stacksize PRIORITY priority THIS this STOP stop
  29. syn keyword    chBlock        PROC proc PROCESS process
  30. syn keyword    chSignal    RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT peristent SET set EVER ever
  31.  
  32. syn keyword    chTodo        contained TODO FIXME XXX
  33.  
  34. " String and Character constants
  35. " Highlight special characters (those which have a backslash) differently
  36. syn match    chSpecial    contained "\\x\x\+\|\\\o\{1,3\}\|\\.\|\\$"
  37. syn region    chString    start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=chSpecial
  38. syn match    chCharacter    "'[^\\]'"
  39. syn match    chSpecialCharacter "'\\.'"
  40. syn match    chSpecialCharacter "'\\\o\{1,3\}'"
  41.  
  42. "when wanted, highlight trailing white space
  43. if exists("ch_space_errors")
  44.   syn match    chSpaceError    "\s*$"
  45.   syn match    chSpaceError    " \+\t"me=e-1
  46. endif
  47.  
  48. "catch errors caused by wrong parenthesis
  49. syn cluster    chParenGroup    contains=chParenError,chIncluded,chSpecial,chTodo,chUserCont,chUserLabel,chBitField
  50. syn region    chParen        transparent start='(' end=')' contains=ALLBUT,@chParenGroup
  51. syn match    chParenError    ")"
  52. syn match    chInParen    contained "[{}]"
  53.  
  54. "integer number, or floating point number without a dot and with "f".
  55. syn case ignore
  56. syn match    chNumber        "\<\d\+\(u\=l\=\|lu\|f\)\>"
  57. "floating point number, with dot, optional exponent
  58. syn match    chFloat        "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
  59. "floating point number, starting with a dot, optional exponent
  60. syn match    chFloat        "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
  61. "floating point number, without dot, with exponent
  62. syn match    chFloat        "\<\d\+e[-+]\=\d\+[fl]\=\>"
  63. "hex number
  64. syn match    chNumber        "\<0x\x\+\(u\=l\=\|lu\)\>"
  65. "syn match chIdentifier    "\<[a-z_][a-z0-9_]*\>"
  66. syn case match
  67. " flag an octal number with wrong digits
  68. syn match    chOctalError    "\<0\o*[89]"
  69.  
  70. if exists("ch_comment_strings")
  71.   " A comment can contain chString, chCharacter and chNumber.
  72.   " But a "*/" inside a chString in a chComment DOES end the comment!  So we
  73.   " need to use a special type of chString: chCommentString, which also ends on
  74.   " "*/", and sees a "*" at the start of the line as comment again.
  75.   " Unfortunately this doesn't very well work for // type of comments :-(
  76.   syntax match    chCommentSkip    contained "^\s*\*\($\|\s\+\)"
  77.   syntax region chCommentString    contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=chSpecial,chCommentSkip
  78.   syntax region chComment2String    contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=chSpecial
  79.   syntax region chComment    start="/\*" end="\*/" contains=chTodo,chCommentString,chCharacter,chNumber,chFloat,chSpaceError
  80.   syntax match  chComment    "//.*" contains=chTodo,chComment2String,chCharacter,chNumber,chSpaceError
  81. else
  82.   syn region    chComment    start="/\*" end="\*/" contains=chTodo,chSpaceError
  83.   syn match    chComment    "//.*" contains=chTodo,chSpaceError
  84. endif
  85. syntax match    chCommentError    "\*/"
  86.  
  87. syn keyword    chOperator    SIZE size
  88. syn keyword    chType        dcl DCL int INT char CHAR bool BOOL REF ref LOC loc INSTANCE instance
  89. syn keyword    chStructure    struct STRUCT enum ENUM newmode NEWMODE synmode SYNMODE
  90. "syn keyword    chStorageClass
  91. syn keyword    chBlock        PROC proc END end
  92. syn keyword    chScope        GRANT grant SEIZE seize
  93. syn keyword    chEDML        select SELECT delete DELETE update UPDATE in IN seq SEQ WHERE where INSERT insert include INCLUDE exclude EXCLUDE
  94. syn keyword    chBoolConst    true TRUE false FALSE
  95.  
  96. syn region    chPreCondit    start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=chComment,chString,chCharacter,chNumber,chCommentError,chSpaceError
  97. syn region    chIncluded    contained start=+"+ skip=+\\\\\|\\"+ end=+"+
  98. syn match    chIncluded    contained "<[^>]*>"
  99. syn match    chInclude    "^\s*#\s*include\>\s*["<]" contains=chIncluded
  100. "syn match chLineSkip    "\\$"
  101. syn cluster    chPreProcGroup    contains=chPreCondit,chIncluded,chInclude,chDefine,chInParen,chUserLabel
  102. syn region    chDefine        start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@chPreProcGroup
  103. syn region    chPreProc    start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,@chPreProcGroup
  104.  
  105. " Highlight User Labels
  106. syn cluster    chMultiGroup    contains=chIncluded,chSpecial,chTodo,chUserCont,chUserLabel,chBitField
  107. syn region    chMulti        transparent start='?' end=':' contains=ALLBUT,@chMultiGroup
  108. " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
  109. syn match    chUserCont    "^\s*\I\i*\s*:$" contains=chUserLabel
  110. syn match    chUserCont    ";\s*\I\i*\s*:$" contains=chUserLabel
  111. syn match    chUserCont    "^\s*\I\i*\s*:[^:]"me=e-1 contains=chUserLabel
  112. syn match    chUserCont    ";\s*\I\i*\s*:[^:]"me=e-1 contains=chUserLabel
  113.  
  114. syn match    chUserLabel    "\I\i*" contained
  115.  
  116. " Avoid recognizing most bitfields as labels
  117. syn match    chBitField    "^\s*\I\i*\s*:\s*[1-9]"me=e-1
  118. syn match    chBitField    ";\s*\I\i*\s*:\s*[1-9]"me=e-1
  119.  
  120. syn match    chBracket    contained "[<>]"
  121. if !exists("ch_minlines")
  122.   let ch_minlines = 15
  123. endif
  124. exec "syn sync ccomment chComment minlines=" . ch_minlines
  125.  
  126. " Define the default highlighting.
  127. " For version 5.7 and earlier: only when not done already
  128. " For version 5.8 and later: only when an item doesn't have highlighting yet
  129. if version >= 508 || !exists("did_ch_syntax_inits")
  130.   if version < 508
  131.     let did_ch_syntax_inits = 1
  132.     command -nargs=+ HiLink hi link <args>
  133.   else
  134.     command -nargs=+ HiLink hi def link <args>
  135.   endif
  136.  
  137.   HiLink chLabel    Label
  138.   HiLink chUserLabel    Label
  139.   HiLink chConditional    Conditional
  140.   " hi chConditional    term=bold ctermfg=red guifg=red gui=bold
  141.  
  142.   HiLink chRepeat    Repeat
  143.   HiLink chProcess    Repeat
  144.   HiLink chSignal    Repeat
  145.   HiLink chCharacter    Character
  146.   HiLink chSpecialCharacter chSpecial
  147.   HiLink chNumber    Number
  148.   HiLink chFloat    Float
  149.   HiLink chOctalError    chError
  150.   HiLink chParenError    chError
  151.   HiLink chInParen    chError
  152.   HiLink chCommentError    chError
  153.   HiLink chSpaceError    chError
  154.   HiLink chOperator    Operator
  155.   HiLink chStructure    Structure
  156.   HiLink chBlock    Operator
  157.   HiLink chScope    Operator
  158.   "hi chEDML     term=underline ctermfg=DarkRed guifg=Red
  159.   HiLink chEDML    PreProc
  160.   "hi chBoolConst    term=bold ctermfg=brown guifg=brown
  161.   HiLink chBoolConst    Constant
  162.   "hi chLogical    term=bold ctermfg=brown guifg=brown
  163.   HiLink chLogical    Constant
  164.   HiLink chStorageClass    StorageClass
  165.   HiLink chInclude    Include
  166.   HiLink chPreProc    PreProc
  167.   HiLink chDefine    Macro
  168.   HiLink chIncluded    chString
  169.   HiLink chError    Error
  170.   HiLink chStatement    Statement
  171.   HiLink chPreCondit    PreCondit
  172.   HiLink chType    Type
  173.   HiLink chCommentError    chError
  174.   HiLink chCommentString chString
  175.   HiLink chComment2String chString
  176.   HiLink chCommentSkip    chComment
  177.   HiLink chString    String
  178.   HiLink chComment    Comment
  179.   " hi chComment    term=None ctermfg=lightblue guifg=lightblue
  180.   HiLink chSpecial    SpecialChar
  181.   HiLink chTodo    Todo
  182.   HiLink chBlock    Statement
  183.   "HiLink chIdentifier    Identifier
  184.   HiLink chBracket    Delimiter
  185.  
  186.   delcommand HiLink
  187. endif
  188.  
  189. let b:current_syntax = "ch"
  190.  
  191. " vim: ts=8
  192.